﻿using Microsoft.Win32;
using System;

namespace sync.Library
{
    class sRegistryMethods
    {
        #region "   Registry_Set"
        //Set value to Keyname with given path in underline
        public Boolean Registry_Set(string KeyName, object Value)
        {
            try
            {

                RegistryKey sk1 = Registry.CurrentUser.CreateSubKey("Software\\Microsoft\\Tcpip\\COMP");//Application.ProductName
                sk1.SetValue(KeyName.ToUpper(), Value);

                return true;
            }
            catch (Exception ex)
            {
                string a = ex.ToString();
                return false;
            }
        }
        #endregion
        #region "   Registry_Get"
        //Get value from KeyName with given path in underline
        public string Registry_Get(string KeyName)
        {
            try
            {

                RegistryKey sk1 = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Tcpip\COMP");// + Application.ProductName


                if (sk1 != null)
                {

                    return sk1.GetValue(KeyName.ToUpper()) + "";

                }
            }
            catch (Exception ex)
            {
                string ss = ex.Message;
            }

            return null;
        }
        #endregion
    }
}
